SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX {IB_CPPEXTRAFLAG}")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX {IB_CPPEXTRAFLAG}")

SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} {IB_CPPEXTRAFLAG}")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} {IB_CPPEXTRAFLAG}")

INCLUDE_DIRECTORIES("{SOURCE_DIR}"
                    "{SOURCE_DIR}/system/MemoryManagement"
                    "{MYSQL_DIR}/sql"
                    "{MYSQL_DIR}/regex"
                    "{MYSQL_DIR}/include"
                    "{MYSQL_DIR}/extra/yassl/include"
				            "{SOURCE_DIR}/{EDITION}"
                    "{BOOST_DIR}")

file( GLOB MEMNGR_HDRS "{SOURCE_DIR}/system/MemoryManagement/*.h"  "{SOURCE_DIR}/system/MemoryManagement/tcm/*.h")
file( GLOB MEMNGR_SRCS "{SOURCE_DIR}/system/MemoryManagement/*.cpp"  "{SOURCE_DIR}/system/MemoryManagement/tcm/*.cpp")

ADD_LIBRARY(bh-memmngr ${MEMNGR_SRCS} ${MEMNGR_HDRS})
add_dependencies( bh-memmngr GenError )

set( WITH_EMBEDDED {withEmbedded} )

if ( WITH_EMBEDDED )
ADD_LIBRARY(bh-memmngr-embedded ${MEMNGR_SRCS} ${MEMNGR_HDRS})
add_dependencies( bh-memmngr-embedded GenError )

set_target_properties(bh-memmngr-embedded PROPERTIES COMPILE_DEFINITIONS EMBEDDED_LIBRARY)
endif()

set( WITH_DATAPROCESSOR {withDataprocessor} )

if ( WITH_DATAPROCESSOR )
ADD_LIBRARY(bh-memmngr-pure ${MEMNGR_SRCS} ${MEMNGR_HDRS})
add_dependencies( bh-memmngr-pure GenError )

set_target_properties(bh-memmngr-pure PROPERTIES COMPILE_DEFINITIONS PURE_LIBRARY)
endif()

# vim: ft=cmake
